class Solution:
    def longestPrefix(self, s: str) -> str:
        if len(s)<2:
            return ''
        for i in range(len(s)-1, 0, -1):
            if s[0:i] == s[len(s)-i:len(s)]:
                return s[0:i]
        return ''


x = Solution()
print(x.longestPrefix('level'))